#include "qpagewidget.h"

#include "qformhost.h"
#include "qkeyboardhost.h"

#include <QVariant>
#include <QStyleOption>
#include <QPainter>

using namespace SHAREDLIB;

QPageWidget::QPageWidget(const QString &type, QWidget *parent):
    QWidget(parent)
{
    if(type=="form")
    {
        m_host=new QFormHost(this);
    }
    else if(type=="keyboard")
    {
        m_host=new QKeyboardHost(this);
    }
    else
    {
        m_host=NULL;
    }
    setProperty("type",type);
    setProperty("plugin","null");

    this->setProperty("className","Page");
    this->setAutoFillBackground(true);
}

void QPageWidget::paintEvent(QPaintEvent *)
 {
     QStyleOption opt;
     opt.init(this);
     QPainter p(this);
     style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
 }
